{% extends "layout.html" %}
{% block content %}
<div class="container">
    <div style="margin-top: 20px">
        <a class="btn btn-primary" href="/user/add/" role="button" target="_blank">
        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-square" viewBox="0 0 16 16">
  <path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"></path>
  <path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"></path>
</svg>
            新建用户
        </a>

    </div>
<table class="table" style="margin-top: 20px">
  <thead>
    <tr>
      <th scope="col">id</th>
      <th scope="col">姓名</th>
      <th scope="col">密码</th>
        <th scope="col">年龄</th>
        <th scope="col">余额</th>
        <th scope="col">入职日期</th>
        <th scope="col">性别</th>
        <th scope="col">所属部门</th>
        <th scope="col">操作</th>
    </tr>
  </thead>
  <tbody>
    {% for obj in queryset %}
    <tr>
      <th scope="row">{{ obj.id }}</th>
        <td>{{ obj.name }}</td>
        <td>{{ obj.password }}</td>
        <td>{{ obj.age }}</td>
        <td>{{ obj.account }}</td>
        <td>{{ obj.create_time|date:"Y-m-d" }}</td>
        <td>{{ obj.get_gender_display }}</td>
        <td>{{ obj.depart.title }}</td>
      <td>
          <a class ="btn btn-primary btn-xs" href="/user/{{ obj.id }}/edit/">编辑</a>
          <a class ="btn btn-danger btn-xs" href="{% url 'user_delete' %}?nid={{ obj.id }}">删除</a>
      </td>
    </tr>
    {% endfor %}
  </tbody>
</table>

</div>
{% endblock %}